package tests.org.nicta.learn.factorization.GreedyResidualFitting;

import static org.junit.Assert.*;

import java.util.HashMap;

import org.junit.Before;
import org.junit.Test;
import org.nicta.learn.factorization.GreedyResidualFitting.GRF;

public class GRFTests {
	
	GRF grfMf;
	@Before 
	public void initialize()throws Exception{
		String ratingsFileLocation = "data/MovieLens/100K/u.data.t=";
		grfMf = new GRF(8, ratingsFileLocation,"100k");
	}
	
	@Test
	public void testOGRFMF() throws Exception{
		String datasetType = "100K";
		String separator = "\\|";
		HashMap<Integer[], Double> residue;
		HashMap<Integer, Double> userAverage = 
				grfMf.getUserAverage(grfMf.itemUserRatings, grfMf.userRatedItems);
		grfMf.ratingNormalizationPerUserAverage(grfMf.ratings, userAverage);

		grfMf.runGrf();
		double[] cost = new double[2];
		cost = grfMf.calculateTestError();
		System.out.println("RMSE : "+cost[0]);
		System.out.println("MAE : " +cost[1]);
		
	}

}
